﻿function FlightTime(xa, xb, ya, yb, p1, p2, own, energy, speed)
{
A = 1155.0;
B = 14.15;
C = 115.75;
dist = A * Math.sqrt(Math.pow(xb - xa, 2.0) + Math.pow(yb - ya, 2.0));
pDist = C * Math.abs(p2 - p1);
time = Math.pow(0.5, own) * Math.pow(0.91, energy) * (Math.sqrt(dist + pDist) + B) + (1 - own) * (5 - speed) / 10;
h = Math.round(time)
m = Math.round((time - h)*60)
s = Math.round((time - h - m) * 60)
return Date(h,m,s)
}